﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Shove.Web.UI;

public partial class UserControls_Image : UCBase
{
    public UserControls_Image()
    {
        Name = "广告图片";

        swpas = new ShoveWebPartAttribute[14];

        swpas[0] = new ShoveWebPartAttribute_Int("控件宽度", "1,1004", 210, "控件宽度");
        swpas[1] = new ShoveWebPartAttribute_Int("控件高度", "1,1004", 300, "控件高度");

        swpas[2] = new ShoveWebPartAttribute_Int("顶部图片宽度", "1,1000", 203, "顶部图片宽度");
        swpas[3] = new ShoveWebPartAttribute_Int("顶部图片高度", "1,1000", 274, "顶部图片高度");
        swpas[4] = new ShoveWebPartAttribute_Text("顶部图片CSS样式", "", "", "顶部图片CSS样式");
        swpas[5] = new ShoveWebPartAttribute_Image("顶部图片路径", "", "", "顶部图片路径");

        swpas[6] = new ShoveWebPartAttribute_Int("中部图片宽度", "1,1000", 200, "中部图片宽度");
        swpas[7] = new ShoveWebPartAttribute_Int("中部图片高度", "1,1000", 80, "中部图片高度");
        swpas[8] = new ShoveWebPartAttribute_Text("中部图片CSS样式", "", "", "中部图片CSS样式");
        swpas[9] = new ShoveWebPartAttribute_Image("中部图片路径", "", "", "中部图片路径");


        swpas[10] = new ShoveWebPartAttribute_Int("底部图片宽度", "1,1000", 200, "底部图片宽度");
        swpas[11] = new ShoveWebPartAttribute_Int("底部图片高度", "1,1000", 80, "底部图片高度");
        swpas[12] = new ShoveWebPartAttribute_Text("底部图片CSS样式", "", "", "底部图片CSS样式");
        swpas[13] = new ShoveWebPartAttribute_Image("底部图片路径", "", "", "底部图片路径");

    }

    protected void Page_Load(object sender, EventArgs e)
    {
        Initlayout();
    }

    private void Initlayout()
    {
        tabctr.Width = swpAttributes[0];
        tabctr.Height = swpAttributes[1];

        img01.Width = Shove._Convert.StrToInt(swpAttributes[2], 0);
        img01.Height = Shove._Convert.StrToInt(swpAttributes[3], 0);
        img01.Attributes.Add("class", swpAttributes[4]);
        img01.ImageUrl = "~/images/flash_banner/" + new DAL.Tables.tbl_Site_TemplatesFile().Open("", "[ID] = 7", "").Rows[0]["FileName"].ToString(); 

        img02.Width = Shove._Convert.StrToInt(swpAttributes[6], 0);
        img02.Height = Shove._Convert.StrToInt(swpAttributes[7], 0);
        img02.Attributes.Add("class", swpAttributes[8]);
        img02.ImageUrl = "~/images/flash_banner/" + new DAL.Tables.tbl_Site_TemplatesFile().Open("", "[ID] = 8", "").Rows[0]["FileName"].ToString(); 

        img03.Width = Shove._Convert.StrToInt(swpAttributes[10], 0);
        img03.Height = Shove._Convert.StrToInt(swpAttributes[11], 0);
        img03.Attributes.Add("class", swpAttributes[12]);
        img03.ImageUrl = "~/images/flash_banner/" + new DAL.Tables.tbl_Site_TemplatesFile().Open("", "[ID] = 9", "").Rows[0]["FileName"].ToString(); 
    }

    protected void img01_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string URL = new DAL.Tables.tbl_Site_TemplatesFile().Open("", "[ID] = 7", "").Rows[0]["Links"].ToString();
            Response.Redirect(URL);
        }
        catch { }
    }

    protected void img02_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string URL = new DAL.Tables.tbl_Site_TemplatesFile().Open("", "[ID] = 8", "").Rows[0]["Links"].ToString();
            Response.Redirect(URL);
        }
        catch { }
    }

    protected void img03_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string URL = new DAL.Tables.tbl_Site_TemplatesFile().Open("", "[ID] = 9", "").Rows[0]["Links"].ToString();
            Response.Redirect(URL);
        }
        catch { }
    }
}
